package com.example.demozy.mapper;

import com.example.demozy.entity.ConditionSheet;
import com.example.demozy.vo.BackTestReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 张展鹏
 */
@Mapper
public interface BackTestMapper {

    /**
     * 获取用户所有的条件单回测报告
     *
     * @param userId : 用户ID
     */
    @Select("SELECT back_test_report_id, condition_sheet_name, stock_name, start_time, end_time, back_test_yield " +
            "FROM condition_sheet, back_test, stock " +
            "WHERE author_id = #{userId} AND condition_sheet.condition_sheet_id = back_test.condition_sheet_id AND back_test.back_test_stock = stock.stock_code")
    List<BackTestReportVO> listAllBackTestReports(@Param("userId") String userId);


}
